package com.lcc.dingtalk.robot.pojo.message.resp;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.util.Collections;

/**
 * @author lincc
 * @version 1.0 2020/8/14
 * 钉钉消息文本返回
 */
@Getter
@Setter
@NoArgsConstructor
public class DingTalkTextResp extends DingTalkBaseResp implements Serializable {
    private static final long serialVersionUID = -2822654131216396844L;
    private Text text;
    private At at;

    private DingTalkTextResp(Text text) {
        this();
        this.setMsgtype("text");
        this.setText(text);
    }

    private DingTalkTextResp(Text text, At at) {
        this();
        this.setMsgtype("text");
        this.setText(text);
        this.setAt(at);
    }

    public static DingTalkTextResp context(String text) {
        return new DingTalkTextResp(new Text(text));
    }

    public static DingTalkTextResp context(String text, String atMobile) {
        return new DingTalkTextResp(new Text(text), new At(Collections.singletonList(atMobile), false));
    }
}
